package logic

import (
	"context"
	"novel-kit/novelrpc/novelrpc"

	"novel-kit/api/internal/svc"
	"novel-kit/api/internal/types"

	"github.com/zeromicro/go-zero/core/logx"
)

type BookDeskShowLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

func NewBookDeskShowLogic(ctx context.Context, svcCtx *svc.ServiceContext) *BookDeskShowLogic {
	return &BookDeskShowLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *BookDeskShowLogic) BookDeskShow(req *types.BookDeskShowRequest) (resp *types.Response, err error) {
	// todo: add your logic here and delete this line
	user, err := l.svcCtx.NovelRpc.BookDeskShow(l.ctx, &novelrpc.BookDeskShowRequest{
		UserId: int64(req.UserId),
	})
	if err != nil {
		return &types.Response{
			Message: err.Error(),
			Code:    500,
			Data:    nil,
		}, nil
	}
	return &types.Response{
		Message: "查询成功",
		Code:    200,
		Data:    user,
	}, nil

}
